import service from '@/utils/request'

const url = {
  // 获取基本信息
  getProfile: '/user/profile/get',
  // 修改基本信息
  changeProfile: '/user/profile/change',
  // 获取关注列表
  followList: '/user/follow/list',
  // 更改关注状态
  changeFollow: '/user/follow/change',
  // 检索相同机构下的用户
  searchInInstitution: '/user/search/institution',
  // 获取学者关系
  getRelation: '/user/relation',
  // 获取用户统计数据
  getStatistic: '/user/statistic'
}

export const User = {
  // 获取基本信息
  getProfile: function (params) {
    return service({
      url: url.getProfile,
      method: 'get',
      params: params
    })
  },
  // 修改基本信息
  changeProfile: function (params) {
    return service({
      url: url.changeProfile,
      method: 'post',
      data: params
    })
  },
  // 获取关注列表
  getFollowList: function (params) {
    return service({
      url: url.followList,
      method: 'get',
      params: params
    })
  },
  // 更改关注状态
  changeFollow: function (params) {
    return service({
      url: url.changeFollow,
      method: 'post',
      data: params
    })
  },
  // 检索相同机构下的用户
  searchInInstitution: function (params) {
    return service({
      url: url.searchInInstitution,
      method: 'get',
      params: params
    })
  },
  // 获取学者关系
  getRelation: function (params) {
    return service({
      url: url.getRelation,
      method: 'get',
      params: params
    })
  },
  // 获取用户统计数据
  getStatistic: function (params) {
    return service({
      url: url.getStatistic,
      method: 'get',
      params: params
    })
  }
}
